package com.isunland.managesystem.ui;

import com.google.gson.Gson;
import com.isunland.managesystem.base.BaseNetworkDialogFragment;
import com.isunland.managesystem.common.ApiConst;
import com.isunland.managesystem.entity.CustomerDialog;
import com.isunland.managesystem.entity.ZTreeNode;
import com.isunland.managesystem.utils.ParamsNotEmpty;
import java.util.ArrayList;
import java.util.HashMap;

/**
 * 对象功能:
 * 开发公司: 北京信普达系统工程有限公司
 * 开发人员: HuXiaoDan
 * 创建时间: 2017/5/24 14:47
 */
public class ToipKindDialogFrament extends BaseNetworkDialogFragment {
  @Override public ArrayList<CustomerDialog> resolveResponse(String arg0) {
    ArrayList<CustomerDialog> list = new ArrayList<>();
    ZTreeNode[] dataList = new Gson().fromJson(arg0, ZTreeNode[].class);

    if (dataList == null || dataList.length == 0) {
      return null;
    }
    for (ZTreeNode aDataList : dataList) {
      list.add(new CustomerDialog(aDataList.getName(), aDataList.getExtParam()));
    }
    return list;
  }

  @Override public String getUrl() {
    return ApiConst.URL_TOPIC_KIND;
  }

  @Override public HashMap<String, String> getparameters() {
    ParamsNotEmpty params = new ParamsNotEmpty();
    params.put("dictFlag", "collectType");
    params.put("type", "");
    return params.getParams();
  }
}
